<style>
</style>
<template>
<div>
    <Card :bordered="false" dis-hover>
        <p slot="title">纸质发票物流跟踪</p>
        <Row :gutter="20">
			<Col span="6">
				<Input v-model="search.invoiceNo" placeholder="发票号码" ></Input>
			</Col>
			<!-- <Col span="6">
				<Input v-model="search.paramData.number" placeholder="订单号" ></Input>
			</Col> -->
			<!-- <Col span="10">
				<DatePicker type="datetimerange" format="yyyy-MM-dd HH:mm"
				placeholder="开票日期" v-model="search.paramData.startDate" style="width:100%;"></DatePicker>
			</Col> -->
			<Col span="2">
				<Button type="primary" icon="ios-search" @click="getdata('search')">搜索</Button>
			</Col>
		</Row>


		<br/>
	    <div class="ivu-table-wrapper" >
            <div class="ivu-table ivu-table-with-fixed-top ">

                <div class="ivu-table-body" >
                    <table class="table_border _table"  cellspacing="0" cellpadding="0" border="0" style="width: 100%;">

                    	<thead>
		                    <tr>
		                    	<!-- <th class="" style="width:60px;">
			                        	<div class="ivu-table-cell">
			                        		<Checkbox v-model="check" lable="" @on-change="checkchange"></Checkbox>
			                        	</div>
			                        </th> -->
		                        <th class="">
		                            <div class="ivu-table-cell">
		                                <span>买方名称</span>
		                            </div>
		                        </th>
		                        <th class="">
		                            <div class="ivu-table-cell">
		                                <span>买方税号</span>
		                            </div>
		                        </th>
		                        <th class="" >
		                            <div class="ivu-table-cell">
		                                <span>发票金额&nbsp;(元)</span>
		                            </div>
		                        </th>
		                        <th class="">
		                            <div class="ivu-table-cell">
		                                <span>发票代码</span>
		                            </div>
		                        </th>
		                        <th class="">
		                            <div class="ivu-table-cell">
		                                <span>发票号码</span>
		                            </div>
		                        </th>
		                        <th class="" style="width:100px;">
		                            <div class="ivu-table-cell">
		                                <span>日期</span>
		                            </div>
		                        </th>
		                        <th class="" style="width:70px;">
		                            <div class="ivu-table-cell">
		                                <span>操作</span>
		                            </div>
		                        </th>
		                    </tr>
	                    </thead>
	                    <tbody class="ivu-table-tbody" v-for="item in data">
		                    <tr class="ivu-table-row">
		                    	<!-- <td class="">
			                            <div class="ivu-table-cell">
			                        		<Checkbox v-model="item.check" lable=""></Checkbox>
			                        	</div>
			                        </td> -->
		                        <td class="">
		                            <div class="ivu-table-cell">
		                                <span>
		                                    {{item.buyer_name}}</span>
		                            </div>
		                        </td>
		                        <td class="">
		                            <div class="ivu-table-cell">
		                                <span>{{item.buyer_tax_no}}</span>
		                            </div>
		                        </td>
		                        <td class="">
		                            <div class="ivu-table-cell">
		                                <span>{{item.invoice_total_price_tax}} </span>
		                            </div>
		                        </td>
		                        <td class="">
		                            <div class="ivu-table-cell">
		                                <span>{{item.invoice_code}}</span>
		                            </div>
		                        </td>
		                        <td class="">
		                            <div class="ivu-table-cell">
		                                <span>{{item.invoice_no}}</span>
		                            </div>
		                        </td>
		                        <td class="">
		                            <div class="ivu-table-cell">
		                                <span>{{item.invoice_date  | formatDate('yyyy-MM-dd')}}</span>
		                            </div>
		                        </td>
		                        <td class="">
		                            <div class="ivu-table-cell">

		                                <Button @click="show(item)" size="small"
		                                :disabled="item.express_state<1 "
		                                >跟踪</Button>



		                            </div>
		                        </td>
		                    </tr>
	                    </tbody>
                    </table>
                    <div class="body_empty" v-if="data.length==0 ">
                    	暂无数据
                    </div>
                </div>
            </div>

        </div>
        <p style="margin-top:10px;">
        	<!-- <Button type="primary" @click="add">添加补录订单</Button> -->
	        <Page  show-total :page-size="page.pageSize" :current="search.currentpage"	:total="page.total"
       		show-total @on-change="changePage" style="float:right;"></Page>
        </p>
    </Card>
     <progres-edit ></progres-edit>
</div>
</template>
<script>
import ProgresEdit from "../Module/progresedit.vue";
export default {
  components: { ProgresEdit },
  data() {
    return {
      check: false,
      page: { pageSize: 10, total: 0 },
      search: { currentpage: 1, orderNo: null, expressFlag: "Y" },
      data: []
    };
  },
  methods: {
    changePage(pageNum) {
      this.search.currentpage = pageNum;
      this.getdata();
    },
    getdata(type) {
      if (type == "search") {
        this.search.currentpage = 1;
      }
      this.axios.post("/invoice/output/findByPage", this.search).then(res => {
        var d = res.data.list;
        for (var i = 0; i < d.length; i++) {
          d[i].show = false;
        }
        this.data = d;
        this.page.total = res.data.total;
        this.search.currentpage = res.data.pageNo || 1;
      });
    },
    show(item) {
      this.$emit("bus_progressedit", item);
    },
    checkchange(item) {
      this.data.forEach(function(val) {
        val.check = item;
      });
    },
    _show(item) {
      item.show = !item.show;
      if (!item.list) {
        this.axios
          .post("/incomeinvoice/usedrecord/" + item.guid, {})
          .then(res => {
            item.list = res.data;
          });
      }
    }
  },
  mounted() {
    $("._table").resizableColumns({});
  },
  created() {
    this.getdata();
  },
  activated() {
    this.getdata();
  }
};
</script>
